package com.laicunba.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SeqUtil {
	private static int HOUR25 = 3600 * 25;
	private static SimpleDateFormat SDF = new SimpleDateFormat("YYMMdd");

	/**
	 * <h4>生成一个新的投标订单编号</h4> <br>
	 * yyMMddX0001<br/>
	 * <div>X取值A-Z</div>
	 * 
	 * @return
	 */
	public static String genNewBidSeq() {
		return formatBidSeqNumber(genNewBidSeqNumber());
	}
	public static long genNewBidSeqNumber() {
		return CacheUtil.incr("sys.incr.seq.bid." + DateUtil.formatDate(new Date()), HOUR25); 
	}
	public static String formatBidSeqNumber(long seq) {
		return SDF.format(new Date()) + ((char) (65 + seq / 10000)) + String.format("%04d", seq % 10000);
	}
}
